package com.dhcc.rarp.web.rest.appointment;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dhcc.framework.common.PageModel;
import com.dhcc.rarp.blh.appointment.AppointmentBlh;
import com.dhcc.rarp.dto.appointment.AppointmentDto;

/**
* 
* <p>标题: {$businessName}Controller.java</p>
* <p>业务描述: 请在这里写上你的业务描述</p>
* 公司:东华医为科技有限公司<br/>
* <p>版权: dhcc2019</p>
* @author: {$GenAuthor}
* @date: {$GenDate}
* @version: V1.0
*/
 
@RestController
@RequestMapping("/dhccApi/appointment/appointment")
public class AppointmentRest {

	@Resource
	private AppointmentBlh appointmentBlh;

	@PostMapping(value="page",consumes="application/json")
	public PageModel pageRest(@RequestBody(required=false) AppointmentDto dto) {
		return this.page(dto);
	}
	@RequestMapping("page")
	public PageModel page(AppointmentDto dto) {
		appointmentBlh.page(dto);
		return dto.getPageModel();
	}

	@PostMapping(value="save",consumes="application/json")
	public AppointmentDto saveRest(@RequestBody AppointmentDto dto) {
		return this.save(dto);
	}
	@RequestMapping("save")
	public AppointmentDto save(AppointmentDto dto) {
		appointmentBlh.save(dto);
		return dto;
	}
	
	@PostMapping(value="deleteById",consumes="application/json")
	public AppointmentDto deleteByIdRest(@RequestBody AppointmentDto dto) {
		return this.deleteById(dto);
	}
	@DeleteMapping("deleteById")
	public AppointmentDto deleteById(AppointmentDto dto) {
		appointmentBlh.deleteById(dto);
		return dto;
	}
	
	@PostMapping(value="findById",consumes="application/json")
	public AppointmentDto findByIdRest(@RequestBody AppointmentDto dto) {
		return this.findById(dto);
	}
	@GetMapping("findById")
	public AppointmentDto findById(AppointmentDto dto) {
		appointmentBlh.findById(dto);
		return dto;
	}
}
